Z-ScoreThe "Z-Score" indicator is a unique and powerful tool designed to help traders identify overbought and oversold conditions in the market. Below is an explanation of its features, usefulness, and what makes it special:
Features:
Z-Score Calculation: The indicator calculates the Z-Score, a statistical measure that represents how far the current price is from the moving average (MA) in terms of standard deviations. It helps identify extreme price movements.
Customizable Parameters: Traders can adjust key parameters such as the Z-Score threshold, the type of MA (e.g., SMA, EMA), and the length of the moving average to suit their trading preferences.
Signal Options: The indicator offers flexibility in terms of signaling. Traders can choose whether to trigger signals when the Z-Score crosses the specified threshold or when it moves away from the threshold.
Visual Signals : Z-Score conditions are represented visually on the chart with color-coded background highlights. Overbought conditions are marked with a red background, while oversold conditions are indicated with a green background.
Information Table: A dynamic information table displays essential details, including the MA type, MA length, MA value, standard deviation, current price, and Z-Score. This information table helps traders make informed decisions.
Usefulness:
Overbought and Oversold Signals: Z-Score is particularly valuable for identifying overbought and oversold market conditions. Traders can use this information to potentially enter or exit positions.
Statistical Analysis: The Z-Score provides a statistical measure of price deviation, offering a data-driven approach to market analysis.
Customization: Traders can customize the indicator to match their trading strategies and preferences, enhancing its adaptability to different trading styles.
Visual Clarity: The visual signals make it easy for traders to quickly spot potential trade opportunities on the price chart.
In summary, the Z-Score indicator is a valuable tool for traders looking to incorporate statistical analysis into their trading strategies. Its customizability, visual signals, and unique statistical approach make it an exceptional choice for identifying overbought and oversold market conditions and potential trading opportunities.
Cari skrip untuk " TABLE"
RSI Screener Multi Timeframe [5ema]This indicator is the simple version of my indicator: RSI Screener and Divergence .
Only show table with values, signals at 5 custom timeframes.
-----
I reused some functions, made by (i believe that):
ยฉpaaax: The table position function.
@kingthies: The RSI divergence function.
@QuantNomad: The function calculated value and array screener for 40+ instruments.
I have commented in my code. Thanks so much!
-----
How it works:
1. Input :
Length of RSI => calculate RSI.
Upper/lower => checking RSI overbought/oversold.
Right bars / left bars => returns price of the pivot low & high point => checking divergence.
Range upper / lower bars => compare the low & high point => checking divergence.
Timeframe => request.security another time frame.
Table position => display screener table.
2. Input bool:
Regular Bearish divergence.
Hidden Bullish divergence .
Hidden Bearish divergence.
3. Basic calculated:
Make function for RSI , pivot low & high point of RSI and price.
Request.security that function for earch time frame.
Result RSI, Divergence.
4. Condition of signal:
Buy condition:
RSI oversold (1)
Bullish divergence (2).
=> Buy if (1) and (2), review buy (1) or (2).
Sell condition:
RSI overbought (3).
Bearish divergence (4).
=> Sell if (3) and (4), review sell (3) or (4).
-----
Table screener:
Time frame.
RSI (green - oversold, red - overbought)
Divergence (>> - regular bullish , << regular bearish , > - hidden bullish , < - hidden bearish ).
Signal (green โฆฟ - Buy, red โฆฟ - Sell, green ใ - review buy, red ใ - review sell).
- Regular Bearish divergence:
- Regular Bullish divergence:
- Regular Bullish divergence + RSI overSold
- Regular Bearish divergence + RSI overBought
-----
This indicator is for reference only, you need your own method and strategy.
If you have any questions, please let me know in the comments.
Price Range Volume Profile [Pt]โ Introduction
The Price Range Volume Profile (PRVP) is a revolutionary indicator. This tool stands out from its peers due to its unique ability to capture the entire price chart history, thus providing a comprehensive volume profile of the entire asset's trading history, as available on TradingView chart. It's worth noting that I believe this tool is the first of its kind to accomplish such a feat. A much recommended tool if you are a volume profile trader.
โ Main Features
โบ Historical Lookback: This feature dives deep into the past, grasping all the historical data of an asset. It's equipped to handle up to 20,000 bars, although users without a premium TradingView account are advised to keep it at a maximum of 10,000 bars, or just use the "Full Historical Lookback" feature.
โบ Volume Profile / POC: Displays the distribution of volume across price levels for the selected price range. The Point of Control (POC), which is the price level with the highest traded volume, is also highlighted.
โบ Customization: Users have the flexibility to adjust the profile's appearance, including profile width, horizontal offset, and the option to fill the background of the profile range.
โบ Time Weighting: This feature allows users to give more weight to recent trading activity, which can be especially useful for intraday traders or during times of high volatility. Note that this feature will impact the volume profile and POC level.
โบ Settings Table: A settings table is displayed on the chart for users to quickly reference their input parameters.
โ Input Parameters
โบ Lookback Timeframe: Determines the period for which the volume profile is generated.
โบ Price Range: The percentage distance to consider for the profile, adjusted above and below the current closing price.
โบ Profile Step size: The granularity of the volume profile. Users can opt for automatic step size based on a predefined calculation or set their preferred tick step size.
โบ Historical Bars Lookback: Determines the number of bars to include in the volume profile calculation.
โบ Profile Visuals: Adjust the appearance and layout of the volume profile on the chart.
โบ Extra: Additional settings including the display of a settings table and its location.
โ Basic Understanding of Volume Profile - How to use PRVP?
Volume Profile is a valuable tool for traders who want insights into where the majority of trading activity has occurred. Here are some tips to make the most of it:
โบ Understand the Basics: Before using the Volume Profile, ensure you understand the difference between it and the standard volume histogram. While both represent volume, the former displays it against price while the latter shows it against time.
โบ Identify High Volume Nodes (HVN) and Low Volume Nodes (LVN):
โ HVN: Areas where there's a lot of trading activity and where the price has spent a lot of time. These areas can act as strong support or resistance.
โ LVN: Areas where there's a lack of trading activity. Prices might move quickly through these areas, and they can act as potential breakpoints or accelerators for price movement.
โบ Locate the Point of Control (POC): This is the price level with the highest traded volume for a specified period. It often acts as a magnet for price, and it can serve as a pivot or reference point.
โบ Trend Confirmation: A shift in the volume profile from one price level to another can confirm a trend. For instance, if higher volume starts to build at higher price levels, it may indicate a strong uptrend.
โบ Watch for Volume Gaps: If there's a significant gap in the volume profile, prices may move quickly through these levels as there's little historical trading activity to act as support or resistance.
โ Other Usage Tips
โ For optimal performance, ensure that the chosen timeframe aligns closely with the chart timeframe. Differences in timeframes may lead to minor discrepancies in the volume profile.
โ To address any errors arising from too many levels displayed on the volume profile, consider increasing the Profile Step size or reducing the Price Range.
AI-Bank-Nifty Tech AnalysisThis code is a TradingView indicator that analyzes the Bank Nifty index of the Indian stock market. It uses various inputs to customize the indicator's appearance and analysis, such as enabling analysis based on the chart's timeframe, detecting bullish and bearish engulfing candles, and setting the table position and style.
The code imports an external script called BankNifty_CSM, which likely contains functions that calculate technical indicators such as the RSI, MACD, VWAP, and more. The code then defines several table cell colors and other styling parameters.
Next, the code defines a table to display the technical analysis of eight bank stocks in the Bank Nifty index. It then defines a function called get_BankComponent_Details that takes a stock symbol as input, requests the stock's OHLCV data, and calculates several technical indicators using the imported CSM_BankNifty functions.
The code also defines two functions called get_EngulfingBullish_Detection and get_EngulfingBearish_Detection to detect bullish and bearish engulfing candles.
Finally, the code calculates the technical analysis for each bank stock using the get_BankComponent_Details function and displays the results in the table. If the engulfing input is enabled, the code also checks for bullish and bearish engulfing candles and displays buy/sell signals accordingly.
The FRAMA stands for "Fractal Adaptive Moving Average," which is a type of moving average that adjusts its smoothing factor based on the fractal dimension of the price data. The fractal dimension reflects self-similarity at different scales. The FRAMA uses this property to adapt to the scale of price movements, capturing short-term and long-term trends while minimizing lag. The FRAMA was developed by John F. Ehlers and is commonly used by traders and analysts in technical analysis to identify trends and generate buy and sell signals. I tried to create this indicator in Pine.
In this context, "RS" stands for "Relative Strength," which is a technical indicator that compares the performance of a particular stock or market sector against a benchmark index.
The "Alligator" is a technical analysis tool that consists of three smoothed moving averages. Introduced by Bill Williams in his book "Trading Chaos," the three lines are called the Jaw, Teeth, and Lips of the Alligator. The Alligator indicator helps traders identify the trend direction and its strength, as well as potential entry and exit points. When the three lines are intertwined or close to each other, it indicates a range-bound market, while a divergence between them indicates a trending market. The position of the price in relation to the Alligator lines can also provide signals, such as a buy signal when the price crosses above the Alligator lines and a sell signal when the price crosses below them.
In addition to these, we have several other commonly used technical indicators, such as MACD, RSI, MFI (Money Flow Index), VWAP, EMA, and Supertrend. I used all the built-in functions for these indicators from TradingView. Thanks to the developer of this TradingView Indicator.
I also created a BankNifty Components Table and checked it on the dashboard.
Candle Counter [theEccentricTrader]โ โ OVERVIEW
This indicator counts the number of confirmed candle scenarios on any given candlestick chart and displays the statistics in a table, which can be repositioned and resized at the user's discretion.
โ โ CONCEPTS
Green and Red Candles
A green candle is one that closes with a high price equal to or above the price it opened.
A red candle is one that closes with a low price that is lower than the price it opened.
Upper Candle Trends
A higher high candle is one that closes with a higher high price than the high price of the preceding candle.
A lower high candle is one that closes with a lower high price than the high price of the preceding candle.
A double-top candle is one that closes with a high price that is equal to the high price of the preceding candle.
Lower Candle Trends
A higher low candle is one that closes with a higher low price than the low price of the preceding candle.
A lower low candle is one that closes with a lower low price than the low price of the preceding candle.
A double-bottom candle is one that closes with a low price that is equal to the low price of the preceding candle.
โ โ FEATURES
Inputs
Start Date
End Date
Position
Text Size
Show Sample Period
Show Plots
Table
The table is colour coded, consists of three columns and twenty-two rows. Blue cells denote all candle scenarios, green cells denote green candle scenarios and red cells denote red candle scenarios.
The candle scenarios are listed in the first column with their corresponding total counts to the right, in the second column. The last row in column one, row twenty-two, displays the sample period which can be adjusted or hidden via indicator settings.
Rows two and three in the third column of the table display the total green and red candles as percentages of total candles. Rows four to nine in column three, coloured blue, display the corresponding candle scenarios as percentages of total candles. Rows ten to fifteen in column three, coloured green, display the corresponding candle scenarios as percentages of total green candles. And lastly, rows sixteen to twenty-one in column three, coloured red, display the corresponding candle scenarios as percentages of total red candles.
Plots
I have added plots as a visual aid to the various candle scenarios listed in the table. Green up-arrows denote higher high candles when above bar and higher low candles when below bar. Red down-arrows denote lower high candles when above bar and lower low candles when below bar. Similarly, blue diamonds when above bar denote double-top candles and when below bar denote double-bottom candles. These plots can also be hidden via indicator settings.
โ โ HOW TO USE
This indicator is intended for research purposes and strategy development. I hope it will be useful in helping to gain a better understanding of the underlying dynamics at play on any given market and timeframe. It can, for example, give you an idea of any inherent biases such as a greater proportion of green candles to red. Or a greater proportion of higher low green candles to lower low green candles. Such information can be very useful when conducting top down analysis across multiple timeframes, or considering trailing stop loss methods.
What you do with these statistics and how far you decide to take your research is entirely up to you, the possibilities are endless.
This is just the first and most basic in a series of indicators that can be used to study objective price action scenarios and develop a systematic approach to trading.
โ โ LIMITATIONS
Some higher timeframe candles on tickers with larger lookbacks such as the DXY, do not actually contain all the open, high, low and close (OHLC) data at the beginning of the chart. Instead, they use the close price for open, high and low prices. So, while we can determine whether the close price is higher or lower than the preceding close price, there is no way of knowing what actually happened intra-bar for these candles. And by default candles that close at the same price as the open price, will be counted as green. You can avoid this problem by utilising the sample period filter.
The green and red candle calculations are based solely on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with. Alternatively, you can replace the scenarios with your own logic to account for the gap anomalies, if you are feeling up to the challenge.
It is also worth noting that the sample size will be limited to your Trading View subscription plan. Premium users get 20,000 candles worth of data, pro+ and pro users get 10,000, and basic users get 5,000. If upgrading is currently not an option, you can always keep a rolling tally of the statistics in an excel spreadsheet or something of the like.
ConsoleLibrary "Console"
โ โ OVERVIEW
An easy way to output messages to a console like table using a a simple "print" function that can be called from anywhere in your code including functions.
โ โ Supports:
- Scrollable console messages
- Customisable number of displayed messages
- More than one "console" for different types of output if required
- The ability to choose which message to start viewing from (useful if the message list is long)
- The ability to place the console table at different positions on the chart to mitigate against
overwriting an existing table.
โ โ Limitations:
The "scrollbar" handle is actually a modified time widget handle. As the handle is grabbed and moved left or right across the chart bars, this script calculates the offset of the bar being pointed to from the last bar in the chart and uses that as the console message offset. However, It isn't possible to position this on the last chart bar with code.
So there are two solutions:
1) Manually change timestamp of the variable scrollStart to the current time (roughly)
eg. scrollStart = "25 Dec 2022 14:30 +0000"
2) Use a higher timeframe (Weeks or Months) and visually find the scroll bar. If it is to the right of the chart bars the console output will read NaN. Grab the handle and move it left and it will snap to the last chart candle position. If it is to the left then find it and move it to the right as needed.
โ โ Notes On Usage
- Import the library as console (the call will be console.print(...) )
- Assign a console variable name and call the console.initialise function
eg. var con1=console.initialise()
- Use the console.print() function to print a message or messages
This takes two parameters:
_consoleName :this is the console name you are printing to
_message: this is the message that you want to display. It is a string and can be built in the normal way using any pinescript string functions like str.tostring() etc
- Use the console.display function to display the messages.
To work as intended this display function should be placed at the last line with the following code
if i_showMessages
....if i_displayTable == "con1"
........display(con1, i_lineOffset, i_rowsToDisplay, i_gotoMsg, posn)
(More "consoles" can be written to and the example code provided with the library shows this in more detail. Also, the indents don't show in these notes)
Lastly, placement of a console.print() without a qualifying "if" statement will occur for every bar. This may be desired. If not then use under an if statement (example in the supplied code).
Happy debugging :)
-----------------------------------------------------------------------------------------------------------
initialise()
โโinitialise: creates the message array
โโParameters:
โโโโ none :
โโReturns: message array: this is assigned to the "console" identifier
print(_consoleName, _message)
โโused to output the desired text string to the console
โโParameters:
โโโโ _consoleName : : the message array
โโโโ _message : : the console message
โโReturns: none
display(_consoleName, _lineOffset, _rowsToDisplay, _gotoMsg, _posn)
โโdisplay: placed in the last section of code. Displays the console messages
โโParameters:
โโโโ _consoleName : : the message array
โโโโ _lineOffset : : the setting of the scroll bar (time widget)
โโโโ _rowsToDisplay : : how many rows to show in the console table
โโโโ _gotoMsg : : which message to display from (default is 0)
โโโโ _posn : : where the console table will be displayed
โโReturns: none
_matrixLibrary "_matrix"
Library helps visualize matrix as array of arrays and enables users to use array methods such as push, pop, shift, unshift etc along with cleanup activities on drawing objects wherever required
unshift(mtx, row) unshift array of lines to first row of the matrix
โโParameters:
โโโโ mtx : matrix of lines
โโโโ row : array of lines to be inserted in row
โโReturns: resulting matrix of lines
unshift(mtx, row) unshift array of labels to first row of the matrix
โโParameters:
โโโโ mtx : matrix of labels
โโโโ row : array of labels to be inserted in row
โโReturns: resulting matrix labels
unshift(mtx, row) unshift array of boxes to first row of the matrix
โโParameters:
โโโโ mtx : matrix of boxes
โโโโ row : array of boxes to be inserted in row
โโReturns: resulting matrix of boxes
unshift(mtx, row) unshift array of linefill to first row of the matrix
โโParameters:
โโโโ mtx : matrix of linefill
โโโโ row : array of linefill to be inserted in row
โโReturns: resulting matrix of linefill
unshift(mtx, row) unshift array of tables to first row of the matrix
โโParameters:
โโโโ mtx : matrix of tables
โโโโ row : array of tables to be inserted in row
โโReturns: resulting matrix of tables
unshift(mtx, row) unshift array of int to first row of the matrix
โโParameters:
โโโโ mtx : matrix of int
โโโโ row : array of int to be inserted in row
โโReturns: resulting matrix of int
unshift(mtx, row) unshift array of float to first row of the matrix
โโParameters:
โโโโ mtx : matrix of float
โโโโ row : array of float to be inserted in row
โโReturns: resulting matrix of float
unshift(mtx, row) unshift array of bool to first row of the matrix
โโParameters:
โโโโ mtx : matrix of bool
โโโโ row : array of bool to be inserted in row
โโReturns: resulting matrix of bool
unshift(mtx, row) unshift array of string to first row of the matrix
โโParameters:
โโโโ mtx : matrix of string
โโโโ row : array of string to be inserted in row
โโReturns: resulting matrix of string
unshift(mtx, row) unshift array of color to first row of the matrix
โโParameters:
โโโโ mtx : matrix of colors
โโโโ row : array of colors to be inserted in row
โโReturns: resulting matrix of colors
push(mtx, row) push array of lines to end of the matrix row
โโParameters:
โโโโ mtx : matrix of lines
โโโโ row : array of lines to be inserted in row
โโReturns: resulting matrix of lines
push(mtx, row) push array of labels to end of the matrix row
โโParameters:
โโโโ mtx : matrix of labels
โโโโ row : array of labels to be inserted in row
โโReturns: resulting matrix of labels
push(mtx, row) push array of boxes to end of the matrix row
โโParameters:
โโโโ mtx : matrix of boxes
โโโโ row : array of boxes to be inserted in row
โโReturns: resulting matrix of boxes
push(mtx, row) push array of linefill to end of the matrix row
โโParameters:
โโโโ mtx : matrix of linefill
โโโโ row : array of linefill to be inserted in row
โโReturns: resulting matrix of linefill
push(mtx, row) push array of tables to end of the matrix row
โโParameters:
โโโโ mtx : matrix of tables
โโโโ row : array of tables to be inserted in row
โโReturns: resulting matrix of tables
push(mtx, row) push array of int to end of the matrix row
โโParameters:
โโโโ mtx : matrix of int
โโโโ row : array of int to be inserted in row
โโReturns: resulting matrix of int
push(mtx, row) push array of float to end of the matrix row
โโParameters:
โโโโ mtx : matrix of float
โโโโ row : array of float to be inserted in row
โโReturns: resulting matrix of float
push(mtx, row) push array of bool to end of the matrix row
โโParameters:
โโโโ mtx : matrix of bool
โโโโ row : array of bool to be inserted in row
โโReturns: resulting matrix of bool
push(mtx, row) push array of string to end of the matrix row
โโParameters:
โโโโ mtx : matrix of string
โโโโ row : array of string to be inserted in row
โโReturns: resulting matrix of string
push(mtx, row) push array of colors to end of the matrix row
โโParameters:
โโโโ mtx : matrix of colors
โโโโ row : array of colors to be inserted in row
โโReturns: resulting matrix of colors
shift(mtx) shift removes first row from matrix of lines
โโParameters:
โโโโ mtx : matrix of lines from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of labels
โโParameters:
โโโโ mtx : matrix of labels from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of boxes
โโParameters:
โโโโ mtx : matrix of boxes from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of linefill
โโParameters:
โโโโ mtx : matrix of linefill from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of tables
โโParameters:
โโโโ mtx : matrix of tables from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of int
โโParameters:
โโโโ mtx : matrix of int from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of float
โโParameters:
โโโโ mtx : matrix of float from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of bool
โโParameters:
โโโโ mtx : matrix of bool from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of string
โโParameters:
โโโโ mtx : matrix of string from which the shift operation need to be performed
โโReturns: void
shift(mtx) shift removes first row from matrix of colors
โโParameters:
โโโโ mtx : matrix of colors from which the shift operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of lines
โโParameters:
โโโโ mtx : matrix of lines from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of labels
โโParameters:
โโโโ mtx : matrix of labels from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of boxes
โโParameters:
โโโโ mtx : matrix of boxes from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of linefill
โโParameters:
โโโโ mtx : matrix of linefill from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of tables
โโParameters:
โโโโ mtx : matrix of tables from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of int
โโParameters:
โโโโ mtx : matrix of int from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of float
โโParameters:
โโโโ mtx : matrix of float from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of bool
โโParameters:
โโโโ mtx : matrix of bool from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of string
โโParameters:
โโโโ mtx : matrix of string from which the pop operation need to be performed
โโReturns: void
pop(mtx) pop removes last row from matrix of colors
โโParameters:
โโโโ mtx : matrix of colors from which the pop operation need to be performed
โโReturns: void
clear(mtx) clear clears the matrix of lines
โโParameters:
โโโโ mtx : matrix of lines which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of labels
โโParameters:
โโโโ mtx : matrix of labels which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of boxes
โโParameters:
โโโโ mtx : matrix of boxes which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of linefill
โโParameters:
โโโโ mtx : matrix of linefill which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of tables
โโParameters:
โโโโ mtx : matrix of tables which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of int
โโParameters:
โโโโ mtx : matrix of int which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of float
โโParameters:
โโโโ mtx : matrix of float which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of bool
โโParameters:
โโโโ mtx : matrix of bool which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of string
โโParameters:
โโโโ mtx : matrix of string which needs to be cleared
โโReturns: void
clear(mtx) clear clears the matrix of colors
โโParameters:
โโโโ mtx : matrix of colors which needs to be cleared
โโReturns: void
Logging in Pine ScriptI'm building quite a lot of pretty complicated indicators/strategies in Pine Script. Quite often they don't work from the 1 try so I have to debug them heavily.
In Pine Script there are no fancy debuggers so you have to be creative. You can plot values on your screens, check them in the data window, etc.
If you want to display some textual information, you can plot some info as labels on the screen.
It's not the most convenient way, so with the appearance of tables in Pine Script, I decided to implement a custom logger that will allow me to track some useful information about my indicator over time.
Tables work much better for this kind of thing than labels. They're attached to your screen, you can nicely scale them and you can style them much better.
The idea behind it is very simple. I used few arrays to store the message, bar number, timestamp, and type of the message (you can color messages depend on the type for example).
There is a function log_msg that just append new messages to these arrays.
In the end, for the last bar, I create the table and display the last X messages in it.
In parameters, you can show/hide the entire journal, change the number of messages displayed and choose an offset. With offset, you can basically scroll through the history of messages.
Currently, I implemented 3 types of messages, and I color messages according to these types:
Message - gray
Warning - yellow
Error - red
Of course, it's a pretty simple example, you can create a much fancier way of styling your logs.
What do you think about it? Is it useful for you? What do you use to debug code in Pine Script?
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as good as in historical backtesting.
This post and the script donโt provide any financial advice.
Daily GAP StatsI did not write the script from scratch but rather started editing code of an existing one. The original code came from a script called GAP DETECTOR by @Asch-
First up: I am a trader, not a programmer and therefore my code most likely is inefficient. If someone with more expertise would like to help and optimize it - feel free to get in touch, I am always happy to learn some new tricks. :)
This script does 2 things:
- It shows daily gaps stats based on user inputs
- It shows color coded labels on gap days with additional information in tooltips ( important: make sure to read 'known issues/limitations' at the end )
User Inputs
==========
Although the input dialog is pretty straight forward, I do a quick rundown:
- Length: max lookback time
- Gap Direction: self explanatory
- Show All Gaps | Cont Only | Reversal Only | Off:
This refers to the way labels are displayed on gap days (again: make sure to read known issues/limitations!)
- Show All Gaps: does what it says
- Cont Only: only shows gaps where price continued in the gap direction. If you filter for gap ups and chose 'Cont only' you will only see labels on gap days where price closed above the open (and vice versa if you scan for gap downs).
- Reversal Only: you will only see labels for closes below the open on gap up days (and the opposite on gap down days)
- Off: self explanatory
- Gap Measure in ATR/PCT: self explanatory, ATR is calculated over a 10d period
- Gap Size (Abs Values): no negative values allowed here. If you filter for gap downs and enter 3 it means it will show gaps where the stock fell more than 3 ATR/PCT on the open.
- RVOL Factor: along with significant gaps should come significant volume. RVOL = volume of the gap day / 20d average volume
- Viewing Options: Placing the stats label in the window is a bit tricky (see knonw issues/limitations) and I was not sure which way I liked better. See for yourself what works best for you.
Known Isusses/Limitations:
=======================
- Positioning of the stats table:
As to my knowledge, Tradingview only allows label positioning relative to price and not relative to the chart window. I tried to always display the gap stats table in the upper right corner, using 52wk high as y-coordinate. This works ok most of the time, but is not pretty. If anybody has some fancy way to tag the label in a fixed position, please get in touch.
- Max number of labels per script:
TradingView has a limitation that allows a maxium of ~50 labels per script. If there are more labels, TradingView will automatically cut the oldest ones, without any notification. I have found this behaviour to be rather inconsistent - sometimes it'll dump labels even if there are a lot fewer than 50. Hopefully TradingView will drop this limitation at one point in the future.
Important: The inconsistent display of the gap day labels has NO INFLUENCE on the calculations in the gap stats table - the count and the calculations are complete and correct!
DeepFlow Zones SNIPER# DeepFlow Zones SNIPER - Documentation & Cheatsheet
## ๐ฏ DeepFlow Zones - SNIPER Edition
**Horizontal Limit Order Zones | Institutional FVG + Single Prints**
> **Philosophy:** *Only mark the zones where institutions MUST have orders. Everything else is noise.*
---
## โก QUICK CHEATSHEET
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DEEPFLOW ZONES SNIPER - QUICK REFERENCE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ฏ ZONE CREATION REQUIREMENTS (ALL MUST BE TRUE): โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ FVG exists โ Gap between candle low and 2-bar-ago high โ
โ โ Gap Size โ At least 30% of ATR (significant gap) โ
โ โ Impulse Candle โ 1.8x average range + 65% body ratio โ
โ โ Volume โ 2.0x+ average on impulse candle โ
โ โ Direction โ Middle candle confirms gap direction โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ ZONE TYPES: โ
โ โโโโโโโโโโโโโโ โ
โ ๐ข BULLISH ZONE โ Green box BELOW price (buy zone) โ
โ ๐ด BEARISH ZONE โ Red box ABOVE price (sell zone) โ
โ โซ TESTED ZONE โ Gray box (CE level touched) โ
โ โฌ BROKEN ZONE โ Dark gray (price closed through) โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โญ SINGLE PRINT LINES: โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ
โ Requirements: โ
โ โข Range 1.8x+ average โ
โ โข Body 65%+ of range โ
โ โข Volume 2.0x+ average โ
โ โข Delta 60%+ confirms direction โ
โ โ
โ Usage: โ
โ โข Gold lines at HIGH and LOW of impulse candle โ
โ โข Price often returns to these levels โ
โ โข Use as support/resistance for entries โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐จ ENTRY SIGNALS: โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ BUY๐ฏ appears when: โ
โ โข Price is inside BULLISH zone โ
โ โข Delta shows 60%+ buy dominance โ
โ โข Volume is 1.5x+ average โ
โ โ
โ SELL๐ฏ appears when: โ
โ โข Price is inside BEARISH zone โ
โ โข Delta shows 60%+ sell dominance โ
โ โข Volume is 1.5x+ average โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐ ZONE ANATOMY: โ
โ โโโโโโโโโโโโโโโโโ โ
โ โ
โ BULLISH FVG ZONE: BEARISH FVG ZONE: โ
โ โ
โ Current Low โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ 2-bar-ago Low โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โโโโโ ZONE โโโโโโโโโโโโโโ โ โโโโโ ZONE โโโโโโโโโโโโโโ โ
โ โ- - - CE (50%) - - - - - โ โ- - - CE (50%) - - - - - โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ 2-bar-ago High โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ Current High โ
โ โ
โ Entry: At or near CE line Entry: At or near CE line โ
โ Stop: Below zone bottom Stop: Above zone top โ
โ Target: 1:1 or 2:1 R:R Target: 1:1 or 2:1 R:R โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โ ZONE IS INVALID WHEN: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Gap size < 30% of ATR (too small) โ
โ โ No impulse candle (weak move) โ
โ โ Volume < 2x average (retail move) โ
โ โ Zone age > 50 bars (stale) โ
โ โ Price already closed through zone โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
## ๐ DETAILED DOCUMENTATION
### What Makes SNIPER Zones Different?
Standard FVG indicators create zones everywhere. SNIPER zones only appear when there's **institutional footprint**:
| Filter | Standard FVG | SNIPER Zones | Why It Matters |
|--------|-------------|--------------|----------------|
| Gap Size | Any gap | **โฅ30% ATR** | Significant imbalance |
| Volume | Optional | **2.0x+ avg** | Institutional volume |
| Impulse | None | **1.8x range** | Real momentum |
| Body | None | **65%+ ratio** | Conviction candle |
| Max Zones | 20-50 | **10 max** | Only the best |
| Zone Life | 100 bars | **50 bars** | Fresh zones only |
---
### How Zones Are Created
```
BULLISH FVG FORMATION:
โโโโโโโโโโโโโโโโโโโโโโโ
Bar 0 (2 bars ago): Bar 1 (Impulse): Bar 2 (Current):
โโโโโโโ โโโโโโโ โโโโโโโ
โ โ โโโโโโโ โ โ
โ โ HIGH โโโโโโ โโโโโโโ โ โ
โ โ โ โโโโโโโ โ โ
โโโโโโโ โ โโโโโโโ โ โโโ LOW
โ โโโโโโโ โโโโโโโ
โ โ
โโโโโโโโโ GAP โโโโโโโโโโโโโโโโโ
(FVG ZONE)
Requirements Met:
โ Current LOW > 2-bar-ago HIGH (gap exists)
โ Gap โฅ 30% of ATR (significant)
โ Bar 1 range โฅ 1.8x average (impulse)
โ Bar 1 body โฅ 65% of range (conviction)
โ Bar 1 volume โฅ 2x average (institutional)
โ Bar 1 was bullish (direction confirms)
RESULT: VALID SNIPER BULLISH ZONE CREATED
```
---
### Single Print Lines Explained
Single Prints mark **institutional impulse candles** where price moved so fast that no orders were filled at those levels. These levels often act as magnets for price.
```
SINGLE PRINT CANDLE:
โโโโโโโโโโโโโโโโโโโโ
HIGH โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ (Gold Line)
โ
โโโโโโโโโโโโโโโโโโโค
โโโโโโโโโโโโโโโโโโโ โ Large body (65%+)
โโโโโโโโโโโโโโโโโโโ โ Strong volume (2x+)
โโโโโโโโโโโโโโโโโโโ โ Clear delta (60%+)
โโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโค
โ
LOW โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ (Gold Line)
These horizontal lines extend 500 bars into the future.
Price often returns to test these levels.
```
---
### Entry Strategy
#### Zone Entry Checklist
```
โก Zone is active (green/red, not gray)
โก Price enters zone from outside
โก Wait for entry signal (BUY๐ฏ or SELL๐ฏ)
โก Verify: Delta + Volume confirming
โก Enter at CE line (dotted white line)
โก Stop below/above zone
โก Target: Opposite side of zone (1:1) or 2:1
```
#### Single Print Entry
```
โก Price returns to single print level
โก Look for reaction (rejection candle)
โก Combine with GRA signal if possible
โก Enter on confirmation candle
โก Stop beyond the single print line
```
---
### Table Legend
| Field | Reading | Color Meaning |
|-------|---------|---------------|
| **Delta** | Buy/Sell % | ๐ข Buy dom, ๐ด Sell dom, โช Neutral |
| **Vol** | Volume ratio | ๐ข โฅ2x, โช <2x |
| **Buy โฌ** | Active buy zones | Count of bullish zones |
| **Sell โฌ** | Active sell zones | Count of bearish zones |
| **Zone** | Current position | AT BUY / AT SELL / --- |
| **Impulse** | Current bar status | ๐ก Yes (impulse), โซ No |
---
### Zone States
| State | Visual | Meaning | Action |
|-------|--------|---------|--------|
| **Fresh** | Bright color | Never tested | Best entries |
| **Tested** | Gray | CE touched | Still valid, less reliable |
| **Broken** | Dark gray | Price closed through | Invalid, ignore |
---
### Integration with GRA v5
The magic happens when you combine both indicators:
```
HIGHEST PROBABILITY SETUP:
โโโโโโโโโโโโโโโโโโโโโโโโโโ
1. DeepFlow shows active zone (green/red box)
2. Price enters the zone
3. GRA5 fires a signal INSIDE the zone
4. Delta confirms on both indicators
5. Volume confirms on both indicators
This is your SNIPER entry. Take it.
Example:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Price enters BULLISH zone โ
โ GRA5 shows: A๐ฏ LONG โ
โ DFZ shows: BUY๐ฏ โ
โ Table: Vol 2.1x, Delta 67%B โ
โ โ
โ ACTION: Full size LONG at CE โ
โ STOP: Below zone bottom โ
โ TARGET: 2:1 R:R โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
### Settings by Instrument
| Instrument | Vol Mult | Gap ATR | Impulse | Max Zones |
|------------|----------|---------|---------|-----------|
| **NQ/ES** | 2.0x | 30% | 1.8x | 10 |
| **YM** | 2.0x | 30% | 1.8x | 10 |
| **GC** | 2.5x | 40% | 2.0x | 8 |
| **BTC** | 2.0x | 25% | 1.5x | 10 |
---
### Common Mistakes
| Mistake | Why It's Bad | Solution |
|---------|-------------|----------|
| Trading every zone | Most zones fail | Wait for entry signal |
| Entering at zone edge | Wrong R:R | Enter at CE (middle) |
| Ignoring broken zones | Already invalidated | Gray = don't trade |
| No delta confirmation | Could be false zone | BUY๐ฏ/SELL๐ฏ required |
| Too many zones | Chart noise | Max 10 zones |
---
### Alert Configuration
| Alert | Priority | Action |
|-------|----------|--------|
| ๐ฏ BUY/SELL ZONE ENTRY | ๐ด High | Check chart immediately |
| NEW BULL/BEAR ZONE | ๐ Medium | Note new zone location |
| ๐ฏ SINGLE PRINT | ๐ข Low | Mark potential S/R |
---
### Pine Script v6 Notes
This indicator uses Pine Script v6 features:
- Array-based zone management
- `request.security_lower_tf()` for delta
- Dynamic zone state tracking
- Efficient garbage collection
**Minimum TradingView Plan:** Pro (for intrabar data)
---
## ๐ Golden Rules
1. **Fewer zones = Better zones.** If you see more than 5 active zones, your settings are too loose.
2. **Fresh zones > Tested zones.** The first touch is always the best.
3. **CE is king.** The middle of the zone (50% level) is your entry point.
4. **Zone + GRA signal = Sniper entry.** This confluence is what we're hunting for.
5. **Gray zones don't exist.** Once broken, pretend the zone was never there.
---
*ยฉ Alexandro Disla - DeepFlow Zones SNIPER*
*Pine Script v6 | TradingView*
Thirdeyechart Gold DoomsdayThirdeyechart Gold Doomsday โ Full Description
Thirdeyechart Gold Simulation Final 3 is a professional-grade TradingView indicator designed to monitor the global gold market across multiple XAU pairs simultaneously. This version is engineered to provide a complete, multi-timeframe view of goldโs momentum while incorporating buy/sell simulation, trend strength, and safe/unsafe trade detection, all in a clean, visually organized table.
Key Functions and Features
Custom Pairs Input
Traders can specify any number of XAU-related pairs using a comma-separated input.
The script dynamically handles all pairs without requiring manual adjustments.
Percent Change Function (f_change)
Calculates the percentage change for a given symbol and timeframe:
pct_change = ((close_tf - open_tf) / open_tf) * 100
Supports weekly (W), daily (D), 4-hour (H4), and 1-hour (H1) timeframes.
Positive changes are colored blue, negative changes red for instant visual assessment.
Table Setup
Dynamically generates a table based on the number of XAU pairs.
Displays Symbol, Week %, Day %, H4 %, H1 %, BuySim, SellSim in a clean, boxed format.
Color-coded cells for easy recognition of positive vs negative momentum.
Buy & Sell Simulation
Separates each timeframe into positive (buy) and negative (sell) contributions:
Positive value โ added to BuySim
Negative value โ added to SellSim
Summed across all timeframes per symbol, allowing a macro-level simulation of market pressure.
Total BuySim / SellSim provides a clear view of dominance without signaling actual trades.
Total Row Calculation
Sums Week, Day, H4, H1 across all symbols to show aggregate market movement.
BuySim and SellSim totals highlight overall market pressure.
Provides context for trend alignment across multiple pairs.
Strength Row (f_strength)
Interprets total movement per timeframe:
>0 โ Strong
<0 โ Weak
0 โ Neutral
Combined with BuySim/SellSim to display a trend bias: โBuy Biasโ or โSell Bias.โ
Safe / Unsafe Trade Detection
Compares total BuySim and SellSim:
distance = abs(totalBuy - totalSell)
threshold = totalAll * 0.50
Trade considered safe if distance โฅ threshold โ green label.
Trade considered unsafe if distance < threshold โ red label.
Provides a reasoning context (e.g., โclear dominance by buyersโ or โsellers can dominate the marketโ), allowing quick risk assessment.
This function ensures traders know whether market momentum is decisive or uncertain.
Visual Design
Uses background colors for header, cells, total, and strength rows to improve readability.
All data is organized in a compact, easy-to-read table, with dynamic scaling depending on the number of pairs.
Why This Indicator is Advanced
Multi-Timeframe Analysis: Simultaneously monitors W, D, H4, H1 for each XAU pair.
Global Perspective: Shows aggregated momentum across 8 gold pairs to track overall market direction.
Risk Awareness: Safe/Unsafe trade detection helps identify strong trends versus indecisive conditions.
Institutional Approach: Combines global data and technical calculation similar to professional trading terminals.
Disclaimer
This indicator is educational and analytical only. It does not provide financial advice or direct trade signals. Users are responsible for their own trading decisions, and all markets carry risk.
ยฉ 2025 Thirdeyechart. All rights reserved. Redistribution or commercial use without permission is prohibited.
Thirdeyechart Index Weekly DoomsdayIndex Weekly โ Version 3 (Dynamic Strength Ranking)
The Index Weekly Dynamic Ranking Version is a professional TradingView indicator designed to give traders a real-time, high-level view of global index momentum. Unlike static tables, this version dynamically ranks indices by weekly strength, placing the strongest index at the top and the weakest at the bottom. Each symbol is displayed with color-coded valuesโblue for positive weekly momentum, red for negativeโmaking it immediately clear which markets are performing strongly and which are under pressure.
This indicator calculates weekly percentage changes for all selected indices using:
pct_week = ((close_week โ open_week) / open_week) * 100
The results are compiled into a ranked table, so symbols automatically reorder themselves based on current strength. This dynamic ranking allows traders to quickly spot the most dominant indices and adjust their strategy accordingly. The table is fully visual and easy to read, with distinct coloring for up and down momentum, providing both clarity and speed for decision-making.
The version is ideal for traders who want to combine global macro perspective with technical setups, as it shows not only the direction of individual indices but also which markets are leading or lagging. By following the strongest index first, traders can align their positions with global momentum rather than relying on a single static chart.
This approach makes weekly index tracking more technical, more advanced, and closer to an institutional-style dashboard, similar to what professional terminals like Bloomberg offer, while remaining lightweight and easy to use on TradingView.
Disclaimer
This tool is for educational and analytical purposes only. It does not provide buy/sell signals or financial advice. Trading involves risk, and all decisions remain the responsibility of the user.
ยฉ 2025 Ajik Boy. All rights reserved. Redistribution or commercial use without permission is prohibited.
Relative Performance Analyzer [AstrideUnicorn]Relative Performance Analyzer (RPA) is a performance analysis tool inspired by the data comparison features found in professional trading terminals. The RPA replicates the analytical approach used by portfolio managers and institutional analysts who routinely compare multiple securities or other types of data to identify relative strength opportunities, make allocation decisions, choose the most optimal investment from several alternatives, and much more.
Key Features:
Multi-Symbol Comparison: Track up to 5 different symbols simultaneously across any asset class or dataset
Two Performance Calculation Methods: Choose between percentage returns or risk-adjusted returns
Interactive Analysis: Drag the start date line on the chart or manually choose the start date in the settings
Professional Visualization: High-contrast color scheme designed for both dark and light chart themes
Live Performance Table: Real-time display of current return values sorted from the top to the worst performers
Practical Use Cases:
ETF Selection: Compare similar ETFs (e.g., SPY vs IVV vs VOO) to identify the most efficient investment
Sector Rotation: Analyze which sectors are showing relative strength for strategic allocation
Competitive Analysis: Compare companies within the same industry to identify leaders (e.g., APPLE vs SAMSUNG vs XIAOMI)
Cross-Asset Allocation: Evaluate performance across stocks, bonds, commodities, and currencies to guide portfolio rebalancing
Risk-Adjusted Decisions: Use risk-adjusted performance to find investments with the best returns per unit of risk
Example Scenarios:
Analyze whether tech stocks are outperforming the broader market by comparing XLK to SPY
Evaluate which emerging market ETF (EEM vs VWO) has provided better risk-adjusted returns over the past year
HOW DOES IT WORK
The indicator calculates and visualizes performance from a user-defined starting point using two methodologies:
Percentage Returns: Standard total return calculation showing percentage change from the start date
Risk-Adjusted Returns: Cumulative returns divided by the volatility (standard deviation), providing insight into the efficiency of performance. An expanding window is used to calculate the volatility, ensuring accurate risk-adjusted comparisons throughout the analysis period.
HOW TO USE
Setup Your Comparison: Enable up to 5 assets and input their symbols in the settings
Set Analysis Period: When you first launch the indicator, select the start date by clicking on the price chart. The vertical start date line will appear. Drag it on the chart or manually input a specific date to change the start date.
Choose Return Type: Select between percentage or risk-adjusted returns based on your analysis needs
Interpret Results
Use the real-time table for precise current values
SETTINGS
Assets 1-5: Toggle on/off and input symbols for comparison (stocks, ETFs, indices, forex, crypto, fundamental data, etc.)
Start Date: Set the initial point for return calculations (drag on chart or input manually)
Return Type: Choose between "Percentage" or "Risk-Adjusted" performance.
D+P All-in-OneD+P=DARVAS+PIVOT
In this script i tried make small combo of multiple metrics.
Along with Darvas+Pivot we have EMA10,20&RSI d,w,m table. i fixed this table to middle right so that its easy to use while using phone.
There is floater table having Day Low& Previous Day Low-% differnce from current price
We have RS rating of O'Neil
Small table having MarketCap,Industry and sector.
TraderDemircan Fibonacci + XABCD Formation v1.0This indicator automatically identifies the most recent significant swing low (Point X) and the subsequent swing high (Point A) to plot a comprehensive set of Fibonacci extension levels.
Beyond a standard Fibonacci tool, this script also projects a potential harmonic XABCD pattern. It identifies a retracement level (Point B) and projects a "C" target based on the XA=BC price projection. This provides traders with a complete visual framework of key support/resistance levels and potential price targets based on the last significant impulse move.
How It Works
Swing Detection (X & A Points): The script scans the previous Lookback Bars (user-defined) to find the lowest low, which it labels as Point X. It then finds the highest high that occurred after Point X, labeling it as Point A.
Fibonacci Levels: The price range between X and A (the "XA leg") is used as the basis (0.0 to 1.0) to draw 18 different Fibonacci levels, including key extensions (1.272, 1.618, 2.618, etc.) and retracements.
XABCD Projection (B & C Points):
Point B: The script dynamically identifies Point B at either the 0.382 or 0.5 retracement level of the XA leg, depending on the current price action. This shows the level that is currently acting as support.
Point C (Target): A target (Point C) is projected by adding the price range of the XA leg to the B point. This creates a classic XA=BC (or AB=CD, where the first leg is XA) price projection, offering a potential target for the next upward move.
Key Features
Automatic Swing Detection: Automatically finds and plots the X and A points, adapting to the latest price action.
Comprehensive Fibonacci Suite: Includes 18 toggleable Fibonacci levels (from 0.0 to 4.618) to cover all common retracement and extension targets.
XABCD Pattern & Target: Visually plots the X-A, A-B, and the projected B-C legs, clearly highlighting the C target.
Dynamic "B" Point: The B point label (0.382 or 0.5) updates to reflect which retracement level is currently in play.
On-Screen Info Table: A clean table in the top-right corner displays the exact price values for X, A, B, and the C Target for quick reference.
Full Customization: Users can control the visibility, color, width, and style of every Fibonacci level and pattern line.
Label Options: Toggle price labels (on the right) and percentage/level labels (on the left) for a clean or detailed chart.
Pivots 15m en 1mThis script is designed for scalpers and day traders who base their entries on low timeframes (like 1m) but reference liquidity levels from higher timeframes (HTF), in this case, 15m.Key Features:HTF Pivots on LTF: It calculates swing highs and swing lows (pivots) from the 15m chart and projects them as horizontal rays onto your 1m chart.Real-Time Mitigation: The rays (representing pending liquidity) are automatically deleted on the 1m candle as soon as the price mitigates (touches or breaks) that level. This allows you to clearly see which levels have already been tested and which have not.Configurable Pivot Strength: Includes an input to define the "Pivot Strength," allowing you to adjust how many candles on each side are needed to confirm a swing point (e.g., a value of 1 creates 3-bar pivots, a value of 2 creates 5-bar pivots, etc.).Info Table: Displays a real-time table with vital information from the current 1m candle:Time remaining until the candle closes.Total range of the candle in ticks.How to Use:This indicator must be loaded exclusively on a 1-minute (1m) chart.Adjust the "Pivot Strength" in the settings according to your strategy (a value of 1 or 2 is recommended).
Trend Duration Forecast [ChartPrime]โฏ OVERVIEW
The Trend Duration Forecast indicator is designed to estimate the probable lifespan of a bullish or bearish trend. Using a Hull Moving Average (HMA) to detect directional shifts, it tracks the duration of each historical trend and calculates an average to forecast how long the current trend is statistically likely to continue. This allows traders to visualize both real-time trend strength and potential exhaustion zones with exceptional clarity.
โฏ KEY FEATURES
Dynamic Trend Detection: Utilizes the Hull Moving Average to identify when price transitions into a new uptrend or downtrend.
Trend Duration Counting: Measures the number of bars in each completed bullish and bearish phase to understand trend persistence.
Forecast Projection: Automatically projects an estimated trend continuation line based on the average length of recent trends.
Real-Time Updates: Continuously updates the โReal Lengthโ label as the trend develops.
Historical Data Table: Displays previous trend durations for both bullish and bearish cycles, along with their averages.
Adaptive Sampling: Uses a customizable sample size to smooth out volatility in the forecast and provide statistically meaningful projections.
Color-Based Clarity: Highlights uptrends in green and downtrends in orange for instant visual interpretation.
โฏ USAGE
Use the Trend Detection Sensitivity setting to control how fast or slow the indicator reacts to trend changes โ lower values increase responsiveness, while higher values smooth out noise.
Compare the Real Length of the ongoing trend with the Probable Length forecast to estimate whether the move is nearing exhaustion.
Observe the historical duration table to understand the average lifespan of trends in the current market structure.
Use the color-coded HMA line and projection arrows to identify when momentum strength is fading and prepare for possible reversals.
Ideal for swing or trend-following strategies where trend longevity is crucial to managing entries and exits effectively.
โฏ CONCLUSION
The Trend Duration Forecast gives traders a quantitative edge by combining real-time trend tracking with statistical forecasting. It helps identify not only when a new trend begins, but also how long itโs likely to persist based on past market behavior. This indicator enhances timing precision for both entries and exits, supporting smarter trend-following decisions with clear, data-driven insights.
Ichimoku MultiTF WillyArt v1.0.0What this indicator does
Ichimoku WillyArt turns the Ichimoku lines into angle-based momentum across multiple timeframes (W, D, 4H, 1H, 30m, 5m).
For each TF it computes the slope (angle in degrees) of:
Tenkan-sen
Kijun-sen
Senkou Span A
Senkou Span B
Angles are normalized so theyโre comparable across assets and scales. You get a table with the angle per line and a quick emoji direction (โ, โ, โ), optional plots of the chosen line, and ready-to-use alerts.
Why angle?
Slope-as-degrees is an intuitive proxy for momentum/impulse:
Positive angle โ line rising (bullish impulse).
Negative angle โ line falling (bearish impulse).
Near zero โ flat/indecisive.
Two normalization modes
ATR (default): slope / ATR. Robust across instruments; less sensitive to price level.
%Price: slope / price. More sensitive; can highlight subtle turns on low-volatility symbols.
Inputs youโll actually care about
Timeframes: W, D, 4H, 1H, 30m, 5m (all fetched MTF, independent of chart TF).
Ichimoku lengths: Tenkan (9), Kijun (26), Span B (52) โ standard defaults.
Bars for slope (ฮN): How many bars back the slope is measured. Higher = smoother, slower.
Threshold (ยฐ) for โstrongโ: Angle magnitude that qualifies as strong โ/โ.
What youโll see
Matrix/Table (top-right): For each TF, the angle (ยฐ) of Tenkan, Kijun, Span A, Span B + an emoji:
โ above threshold, โ below โthreshold, โ in between.
Optional plots: Toggle โPlot anglesโ to visualize the chosen seriesโ angle across TFs.
Alerts included (ready to pick in โCreate Alertโ)
Sustained state: e.g., โKijun 4H: strong โ angleโ triggers while angle > threshold.
Threshold cross (one-shot): e.g., โKijun 1H: upward threshold crossโ fires on crossing.
Consensus (multi-TF): โKijun consensus โ (D/4H/1H/30m/5m)โ when all selected TFs align up (and the symmetric down case).
Messages are constant strings (TradingView requirement), so they compile cleanly. If you want dynamic text (current angle, threshold value, etc.), enable your own alert() callsโthis script structure supports adding them.
How to use it (workflow)
Add to chart. No need to switch chart TF; the script pulls W/D/4H/1H/30m/5m internally.
Pick normalization. Start with ATR. Switch to %Price if you want more sensitivity.
Set ฮN & threshold.
Intraday momentum: try ฮN = 3โ5 and threshold โ 4โ8ยฐ.
Swing/position: ฮN = 5โ9 and threshold โ 3โ6ยฐ (with ATR).
Scan the table. Look for alignment (multiple TFs with โ or โ on Kijun/Spans).
Kijun + Span A up together โ trending push.
Span B up/down โ cloud baseline tilting (trend quality).
Turn on alerts that match your style: reactive cross for entries, sustained for trend follow, consensus to filter noise.
Reading tips
Kijun angle: great โtrend backbone.โ Strong โ on several TFs = higher-probability pullback buys.
Span A vs. Span B:
Span A reacts faster (momentum).
Span B is slower (structure).
When both tilt the same way, the cloud is genuinely rotating.
Mixed signals? Use higher TFs (W/D/4H) as bias, lower TFs (1H/30m/5m) for timing.
Good to know (limits & best practices)
Angles measure rate of change, not overbought/oversold. Combine with price structure and risk rules.
Extremely low volatility or illiquid symbols can produce tiny anglesโ%Price mode may help.
ฮN and thresholds are contextual: adapt per market (crypto vs FX vs equities).
Want me to bundle a โpro templateโ of alert presets (intraday / swing) and a heatmap color scale for the table? Happy to ship v2. ๐
GEX Delta Hedging Lines - v.4.1GEX Delta Hedging Indicator - Institutional Levels
Introduction
This Pine Script indicator is designed to visualize Gamma Exposure (GEX) levels, Delta Hedging zones, and institutional support/resistance points on your TradingView charts. It helps traders identify key price levels where market makers and institutions might hedge their options positions, potentially leading to price reversals or continuations. The indicator overlays lines for resistances (Call Wall, R1, R2), supports (Put Wall, S1, S2, S3), a Gamma Flip zone, and customizable trading zones (Buy, Neutral, Sell). It also includes alerts for level breaches and a summary table for quick reference.
Key Features
Resistance Levels: Call Wall (maximum resistance), R1 (strong), R2 (light) โ all configurable with colors, styles, and widths.
Support Levels: Put Wall (maximum support), S1 (strong), S2 (moderate), S3 (weak/danger) โ fully customizable.
Gamma Flip Zone: Indicates potential regime changes in market behavior.
Trading Zones: Visual boxes for Buy (green), Neutral (yellow), and Sell (red) areas, with adjustable boundaries and colors.
Current Price Line: Dotted line for the reference price, with labels.
Alerts: Trigger notifications when levels are tested or broken.
Summary Table: Displays levels, prices, and distances from the current close, positioned customizable.
Style Options: Adjust line widths, styles (solid/dashed/dotted), label sizes, and more for a personalized view.
Luxy Adaptive MA Cloud - Trend Strength & Signal Tracker V2Luxy Adaptive MA Cloud - Professional Trend Strength & Signal Tracker
Next-generation moving average cloud indicator combining ultra-smooth gradient visualization with intelligent momentum detection. Built for traders who demand clarity, precision, and actionable insights.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
WHAT MAKES THIS INDICATOR SPECIAL?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Unlike traditional MA indicators that show static lines, Luxy Adaptive MA Cloud creates a living, breathing visualization of market momentum. Here's what sets it apart:
Exponential Gradient Technology
This isn't just a simple fill between two lines. It's a professionally engineered gradient system with 26 precision layers using exponential density distribution. The result? An organic, cloud-like appearance where the center is dramatically darker (15% transparency - where crossovers and price action occur), while edges fade gracefully (75% transparency). Think of it as a visual "heat map" of trend strength.
Dynamic Momentum Intelligence
Most MA clouds only show structure (which MA is on top). This indicator shows momentum strength in real-time through four intelligent states:
- ๐ข Bright Green = Explosive bullish momentum (both MAs rising strongly)
- ๐ต Blue = Weakening bullish (structure intact, but momentum fading)
- ๐ Orange = Caution zone (bearish structure forming, weak momentum)
- ๐ด Deep Red = Strong bearish momentum (both MAs falling)
The cloud literally tells you when trends are accelerating or losing steam.
Conditional Performance Architecture
Every calculation is optimized for speed. Disable a feature? It stops calculating entirelyโnot just hidden, but not computed . The 26-layer gradient only renders when enabled. Toggle signals off? Those crossover checks don't run. This makes it one of the most efficient cloud indicators available, even with its advanced visual system.
Zero Repaint Guarantee
All signals and momentum states are based on confirmed bar data only . What you see in historical data is exactly what you would have seen trading live. No lookahead bias. No repainting tricks. No signals that "magically" appear perfect in hindsight. If a signal shows in history, it would have triggered in real-time at that exact moment.
Educational by Design
Every single input includes comprehensive tooltips with:
- Clear explanations of what each parameter does
- Practical examples of when to use different settings
- Recommended configurations for scalping, day trading, and swing trading
- Real-world trading impact ("This affects entry timing" vs "This is visual only")
You're not just getting an indicatorโyou're learning how to use it effectively .
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
THE GRADIENT CLOUD - TECHNICAL DETAILS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Architecture:
26 precision layers for silk-smooth transitions
Exponential density curve - layers packed tightly near center (where crossovers happen), spread wider at edges
75%-15% transparency range - center is highly opaque (15%), edges fade gracefully (75%)
V-Gradient design - emphasizes the action zone between Fast and Medium MAs
The Four Momentum States:
๐ข GREEN - Strong Bullish
Fast MA above Medium MA
Both MAs rising with momentum > 0.02%
Action: Enter/hold LONG positions, strong uptrend confirmed
๐ต BLUE - Weak Bullish
Fast MA above Medium MA
Weak or flat momentum
Action: Caution - bullish structure but losing strength, consider trailing stops
๐ ORANGE - Weak Bearish
Medium MA above Fast MA
Weak or flat momentum
Action: Warning - bearish structure developing, consider exits
๐ด RED - Strong Bearish
Medium MA above Fast MA
Both MAs falling with momentum < -0.02%
Action: Enter/hold SHORT positions, strong downtrend confirmed
Smooth Transitions: The momentum score is smoothed using an 8-bar EMA to eliminate noise and prevent whipsaws. You see the true trend , not every minor fluctuation.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FLEXIBLE MOVING AVERAGE SYSTEM
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Three Customizable MAs:
Fast MA (default: EMA 10) - Reacts quickly to price changes, defines short-term momentum
Medium MA (default: EMA 20) - Balances responsiveness with stability, core trend reference
Slow MA (default: SMA 200, optional) - Long-term trend filter, major support/resistance
Six MA Types Available:
EMA - Exponential; faster response, ideal for momentum and day trading
SMA - Simple; smooth and stable, best for swing trading and trend following
WMA - Weighted; middle ground between EMA and SMA
VWMA - Volume-weighted; reflects market participation, useful for liquid markets
RMA - Wilder's smoothing; used in RSI/ADX, excellent for trend filters
HMA - Hull; extremely responsive with minimal lag, aggressive option
Recommended Settings by Trading Style:
Scalping (1m-5m):
Fast: EMA(5-8)
Medium: EMA(10-15)
Slow: Not needed or EMA(50)
Day Trading (5m-1h):
Fast: EMA(10-12)
Medium: EMA(20-21)
Slow: SMA(200) for bias
Swing Trading (4h-1D):
Fast: EMA(10-20)
Medium: EMA(34-50)
Slow: SMA(200)
Pro Tip: Start with Fast < Medium < Slow lengths. The gradient works best when there's clear separation between Fast and Medium MAs.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CROSSOVER SIGNALS - CLEAN & RELIABLE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Golden Cross โฌ LONG Signal
Fast MA crosses above Medium MA
Classic bullish reversal or trend continuation signal
Most reliable when accompanied by GREEN cloud (strong momentum)
Death Cross โฌ SHORT Signal
Fast MA crosses below Medium MA
Classic bearish reversal or trend continuation signal
Most reliable when accompanied by RED cloud (strong momentum)
Signal Intelligence:
Anti-spam filter - Minimum 5 bars between signals prevents noise
Clean labels - Placed precisely at crossover points
Alert-ready - Built-in ALERTS for automated trading systems
No repainting - Signals based on confirmed bars only
Signal Quality Assessment:
High-Quality Entry:
Golden Cross + GREEN cloud + Price above both MAs
= Strong bullish setup โ
Low-Quality Entry (skip or wait):
Golden Cross + ORANGE cloud + Choppy price action
= Weak bullish setup, likely whipsaw โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
REAL-TIME INFO PANEL
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
An at-a-glance dashboard showing:
Trend Strength Indicator:
Visual display of current momentum state
Color-coded header matching cloud color
Instant recognition of market bias
MA Distance Table:
Shows percentage distance of price from each enabled MA:
Green rows : Price ABOVE MA (bullish)
Red rows : Price BELOW MA (bearish)
Gray rows : Price AT MA (rare, decision point)
Distance Interpretation:
+2% to +5%: Healthy uptrend
+5% to +10%: Getting extended, caution
+10%+: Overextended, expect pullback
-2% to -5%: Testing support
-5% to -10%: Oversold zone
-10%+: Deep correction or downtrend
Customization:
4 corner positions
5 font sizes (Tiny to Huge)
Toggle visibility on/off
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
HOW TO USE - PRACTICAL TRADING GUIDE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
STRATEGY 1: Trend Following
Identify trend : Wait for GREEN (bullish) or RED (bearish) cloud
Enter on signal : Golden Cross in GREEN cloud = LONG, Death Cross in RED cloud = SHORT
Hold position : While cloud maintains color
Exit signals :
โข Cloud turns ORANGE/BLUE = momentum weakening, tighten stops
โข Opposite crossover = close position
โข Cloud turns opposite color = full reversal
STRATEGY 2: Pullback Entries
Confirm trend : GREEN cloud established (bullish bias)
Wait for pullback : Price touches or crosses below Fast MA
Enter when : Price rebounds back above Fast MA with cloud still GREEN
Stop loss : Below Medium MA or recent swing low
Target : Previous high or when cloud weakens
STRATEGY 3: Momentum Confirmation
Your setup triggers : (e.g., chart pattern, support/resistance)
Check cloud color :
โข GREEN = proceed with LONG
โข RED = proceed with SHORT
โข BLUE/ORANGE = skip or reduce size
Use gradient as confluence : Not as primary signal, but as momentum filter
Risk Management Tips:
Never enter against the cloud color (don't LONG in RED cloud)
Reduce position size during BLUE/ORANGE (transition periods)
Place stops beyond Medium MA for swing trades
Use Slow MA (200) as final trend filter - don't SHORT above it in uptrends
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
PERFORMANCE & OPTIMIZATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Tested On:
Crypto: BTC, ETH, major altcoins
Stocks: SPY, AAPL, TSLA, QQQ
Forex: EUR/USD, GBP/USD, USD/JPY
Indices: S&P 500, NASDAQ, DJI
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TRANSPARENCY & RELIABILITY
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Educational Focus:
Detailed tooltips on every input
Clear documentation of methodology
Practical examples in descriptions
Teaches you why , not just what
Open Logic:
Momentum calculation: (Fast slope + Medium slope) / 2
Smoothing: 8-bar EMA to reduce noise
Thresholds: ยฑ0.02% for strong momentum classification
Everything is transparent and explainable
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
COMPLETE FEATURE LIST
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Visual Components:
26-layer exponential gradient cloud
3 customizable moving average lines
Golden Cross / Death Cross labels
Real-time info panel with trend strength
MA distance table
Calculation Features:
6 MA types (EMA, SMA, WMA, VWMA, RMA, HMA)
Momentum-based cloud coloring
Smoothed trend strength scoring
Conditional performance optimization
Customization Options:
All MA lengths adjustable
All colors customizable (when gradient disabled)
Panel position (4 corners)
Font sizes (5 options)
Toggle any feature on/off
Signal Features:
Anti-spam filter (configurable gap)
Clean, non-overlapping labels
Built-in alert conditions
No repainting guarantee
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
IMPORTANT DISCLAIMERS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
This indicator is for educational and informational purposes only
Not financial advice - always do your own research
Past performance does not guarantee future results
Use proper risk management - never risk more than you can afford to lose
Test on paper/demo accounts before using with real money
Combine with other analysis methods - no single indicator is perfect
Works best in trending markets; less effective in choppy/sideways conditions
Signals may perform differently in different timeframes and market conditions
The indicator uses historical data for MA calculations - allow sufficient lookback period
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CREDITS & TECHNICAL INFO
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Version: 2.0
Release: October 2025
Special Thanks:
TradingView community for feedback and testing
Pine Script documentation for technical reference
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SUPPORT & UPDATES
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Found a bug? Comment below with:
Ticker symbol
Timeframe
Screenshot if possible
Steps to reproduce
Feature requests? I'm always looking to improve! Share your ideas in the comments.
Questions? Check the tooltips first (hover over any input) - most answers are there. If still stuck, ask in comments.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Happy Trading!
Remember: The best indicator is the one you understand and use consistently. Take time to learn how the cloud behaves in different market conditions. Practice on paper before going live. Trade smart, manage risk, and may the trends be with you! ๐
Portfolio Strategy TesterThe Portfolio Strategy Tester is an institutional-grade backtesting framework that evaluates the performance of trend-following strategies on multi-asset portfolios. It enables users to construct custom portfolios of up to 30 assets and apply moving average crossover strategies across individual holdings. The model features a clear, color-coded table that provides a side-by-side comparison between the buy-and-hold portfolio and the portfolio using the risk management strategy, offering a comprehensive assessment of both approaches relative to the benchmark.
Portfolios are constructed by entering each ticker symbol in the menu, assigning its respective weight, and reviewing the total sum of individual weights displayed at the top left of the table. For strategy selection, users can choose between Exponential Moving Average (EMA), Simple Moving Average (SMA), Wilderโs Moving Average (RMA), Weighted Moving Average (WMA), Moving Average Convergence Divergence (MACD), and Volume-Weighted Moving Average (VWMA). Moving average lengths are defined in the menu and apply only to strategy-enabled assets.
To accurately replicate real-world portfolio conditions, users can choose between daily, weekly, monthly, or quarterly rebalancing frequencies and decide whether cash is held or redistributed. Daily rebalancing maintains constant portfolio weights, while longer intervals allow natural drift. When cash positions are not allowed, capital from bearish assets is automatically redistributed proportionally among bullish assets, ensuring the portfolio remains fully invested at all times. The table displays a comprehensive set of widely used institutional-grade performance metrics:
CAGR = Compounded annual growth rate of returns.
Volatility = Annualized standard deviation of returns.
Sharpe = CAGR per unit of annualized standard deviation.
Sortino = CAGR per unit of annualized downside deviation.
Calmar = CAGR relative to maximum drawdown.
Max DD = Largest peak-to-trough decline in value.
Beta (ฮฒ) = Sensitivity of returns relative to benchmark returns.
Alpha (ฮฑ) = Excess annualized risk-adjusted returns relative to benchmark.
Upside = Ratio of average return to benchmark return on up days.
Downside = Ratio of average return to benchmark return on down days.
Tracking = Annualized standard deviation of returns versus benchmark.
Turnover = Average sum of absolute changes in weights per year.
Cumulative returns are displayed on each label as the total percentage gain from the selected start date, with green indicating positive returns and red indicating negative returns. In the table, baseline metrics serve as the benchmark reference and are always gray. For portfolio metrics, green indicates outperformance relative to the baseline, while red indicates underperformance relative to the baseline. For strategy metrics, green indicates outperformance relative to both the baseline and the portfolio, red indicates underperformance relative to both, and gray indicates underperformance relative to either the baseline or portfolio. Metrics such as Volatility, Tracking Error, and Turnover ratio are always displayed in gray as they serve as descriptive measures.
In summary, the Portfolio Strategy Tester is a comprehensive backtesting tool designed to help investors evaluate different trend-following strategies on custom portfolios. It enables real-world simulation of both active and passive investment approaches and provides a full set of standard institutional-grade performance metrics to support data-driven comparisons. While results are based on historical performance, the model serves as a powerful portfolio management and research framework for developing, validating, and refining systematic investment strategies.
SFC Bollinger Band and Banditๆฆ่ฟฐ (Overview)
SFC ๅธๆ้้่ๆตท็็ญ็ฅ (SFC Bollinger Band and Bandit Strategy) ๆฏไธๅๅบๆผ Pine Scriptโข v6 ็ๆ่กๅๆๆๆจ๏ผ็ตๅๅธๆ้้ (Bollinger Bands)ใ็งปๅๅนณๅ็ท (Moving Averages) ไปฅๅๅธๆๆตท็ (Bollinger Bandit) ไบคๆ็ญ็ฅ๏ผๆจๅจ็บไบคๆ่
ๆไพๅคๆ้ๆกๆถ็่ถจๅขๅๆ่้ฒๅบๅ ด่จ่ใ่ฉฒ่
ณๆฌๆฏๆด้ขจ้ช็ฎก็ๅ่ฝ๏ผไธฆๆไพ่ฆ่ฆบๅๅ่กจ่ไบคๆ่จ่ๆ็คบ๏ผ้ฉ็จๆผๅค็จฎ้่ๅธๅ ดใ
This script, written in Pine Scriptโข v6, combines Bollinger Bands, Moving Averages, and the Bollinger Bandit strategy to provide traders with multi-timeframe trend analysis and entry/exit signals. It includes risk management features and visualizes data through charts and trading signals, suitable for various financial markets.
ๅ่ฝ็น้ป (Key Features)
ๅธๆ้้ (Bollinger Bands)
ๆไพๅฏ่ชฟๆด็ๆจๆบๅทฎๅๆธ (ฯ1, ฯ2)๏ผๆฏๆดๅคๅฑคๅธๆ้้้กฏ็คบใ
้ฒๅ ด่จ่ๅบๆผๅนๆ ผ็ฉฟ่ถๅธๆ้้ไธไธ่ป๏ผไธฆ็ตๅ้ฃ็บK็ท็ขบ่ชๆฉๅถใ
Provides adjustable standard deviation parameters (ฯ1, ฯ2) for multi-layer Bollinger Bands display.
Entry signals are based on price crossing the upper/lower bands, combined with a consecutive bar confirmation mechanism.
็งปๅๅนณๅ็ท (Moving Averages)
ๆฏๆด็ฐกๅฎ็งปๅๅนณๅ็ท (SMA) ๆๆๆธ็งปๅๅนณๅ็ท (EMA)๏ผๅฏ่ช่จๅฟซใไธญใๆ
ข็ท้ฑๆใ
Supports Simple Moving Average (SMA) or Exponential Moving Average (EMA) with customizable fast, medium, and slow line periods.
ๅธๆๆตท็็ญ็ฅ (Bollinger Bandit Strategy)
ๅบๆผ่ฎๅ็ (ROC) ่ๅธๆ้้ๅๆ
ๆญขๆ๏ผๆไพๅๅค่ๅ็ฉบ่จ่ใ
ๅ
ๅซๅๆ
ๆญขๆๅ็ท่ๅนณๅๅคฉๆธ่จญๅฎ๏ผๅขๅผทไบคๆ้ๆดปๆงใ
Utilizes Rate of Change (ROC) and Bollinger Bands with dynamic stop-loss for long and short signals.
Includes dynamic stop-loss moving average and liquidation days for enhanced trading flexibility.
ๅคๆ้ๆกๆถๅๆ (Multi-Timeframe Analysis)
ๆฏๆดๅ
ญๅๆ้ๆกๆถ (5ๅใ15ๅใ1ๅฐๆใ4ๅฐๆใๆฅ็ทใ้ฑ็ท) ็่ถจๅขๅๆใ
้้่กจๆ ผ้กฏ็คบๅๆ้ๆกๆถ็้ฃ็บไธๆผฒ/ไธ่ท่ถจๅข๏ผ่ผๅฉไบคๆๆฑบ็ญใ
Supports trend analysis across six timeframes (5m, 15m, 1h, 4h, daily, weekly).
Displays consecutive up/down trends in a table to aid decision-making.
้ขจ้ช็ฎก็ (Risk Management)
ๆไพๅบๆผ ATR ๆๅธๆ้้็ๅๅฉ/ๅๆ่จญๅฎใ
่ชๅ่จ็ฎไบคๆๆๆธ๏ผๆ นๆๅ ฑๅน่ฒจๅนฃๅฏ็่ชฟๆด้ขจ้ชๆๅฃใ
Offers take-profit/stop-loss settings based on ATR or Bollinger Bands.
Automatically calculates trading lots, adjusting risk exposure based on quote currency exchange rates.
่ฆ่ฆบๅ่ๆ็คบ (Visualization and Alerts)
็นช่ฃฝๅธๆ้้ใ็งปๅๅนณๅ็ทใๆตท็็ญ็ฅๅๆ
ๆญขๆ็ทๅไบคๆ่จ่ใ
ๆไพๅคๆ้ๆกๆถ่ถจๅข่กจๆ ผใไบคๆๆๆธๆจ็ฑคๅๆตฎๆฐดๅฐใ
ๆฏๆดไบคๆ่จ่ๅฟซ่จ๏ผๆนไพฟๅณๆ็ฃๆงใ
Plots Bollinger Bands, Moving Averages, Bandit strategy stop-loss lines, and trading signals.
Includes multi-timeframe trend tables, trading lot labels, and watermark.
Supports alert conditions for real-time trade monitoring.
ไฝฟ็จ่ชชๆ (Usage Instructions)
่จญ็ฝฎๅๆธ (Parameter Setup)
ๅธๆ้้ (Bollinger Bands): ๅฏ่ชฟๆด้ฑๆ (้ ่จญ21)ใๆจๆบๅทฎ (ฯ1=1, ฯ2=2) ๅๅๅฉ/ๅๆไพๆ (ATR ๆ BAND)ใ
็งปๅๅนณๅ็ท (Moving Averages): ๅฏ้ธๆ้กฏ็คบๅฟซ็ท (10)ใไธญ็ท (20)ใๆ
ข็ท (60)๏ผไธฆๅๆ SMA/EMAใ
ๅธๆๆตท็ (Bollinger Bandit): ่ชฟๆด้้้ฑๆ (50)ใๅนณๅๅ็ท้ฑๆ (50) ๅ ROC ้ฑๆ (30)ใ
ๆ้ๆกๆถ (Timeframes): ่ช่จๅ
ญๅๆ้ๆกๆถ๏ผ้ ่จญ็บ 5ๅใ15ๅใ1ๅฐๆใ4ๅฐๆใๆฅ็ทใ้ฑ็ทใ
Adjust Bollinger Band period (default 21), standard deviations (ฯ1=1, ฯ2=2), and take-profit/stop-loss basis (ATR or BAND).
Configure Moving Averages (fast=10, medium=20, slow=60) and toggle SMA/EMA.
Set Bollinger Bandit parameters: channel period (50), liquidation MA period (50), ROC period (30).
Customize six timeframes (default: 5m, 15m, 1h, 4h, daily, weekly).
ไบคๆ่จ่ (Trading Signals)
่ฒทๅ
ฅ่จ่ (Buy): ๅนๆ ผ็ฉฟ่ถไธ่ปไธๆปฟ่ถณ้ฃ็บK็ทๆขไปถใ
่ณฃๅบ่จ่ (Sell): ๅนๆ ผ็ฉฟ่ถไธ่ปไธๆปฟ่ถณ้ฃ็บK็ทๆขไปถใ
ๆตท็็ญ็ฅ่จ่: ๅบๆผ ROC ่ๅธๆ้้็ฉฟ่ถ๏ผ็ตๅๅๆ
ๆญขๆใ
Buy signal: Price crosses below lower band with consecutive bar confirmation.
Sell signal: Price crosses above upper band with consecutive bar confirmation.
Bandit strategy signals: Based on ROC and band crossings with dynamic stop-loss.
่ฆ่ฆบๅ (Visualization)
ๅธๆ้้ไปฅไธๅ้ก่ฒ้กฏ็คบไธไธ่ป่ไธญ่ปใ
็งปๅๅนณๅ็ทไปฅๅฟซใไธญใๆ
ข็ทๅๅ้ก่ฒใ
่ถจๅข่กจๆ ผ้กฏ็คบๅๆ้ๆกๆถ็่ถจๅข็ๆ
(๐ดไธๆผฒ, ๐ขไธ่ท, โชไธญๆง)ใ
ๆตท็็ญ็ฅ้กฏ็คบๅๆ
ๆญขๆ็ท่ไบคๆ็ๆ
ใ
Bollinger Bands display upper, lower, and middle bands in distinct colors.
Moving Averages use different colors for fast, medium, and slow lines.
Trend table shows timeframe trends (๐ด up, ๐ข down, โช neutral).
Bandit strategy displays dynamic stop-loss and trading status.
Jensen Alpha RS๐ง Jensen Alpha RS (J-Alpha RS)
Jensen Alpha RS is a quantitative performance evaluation tool designed to compare multiple assets against a benchmark using Jensenโs Alpha โ a classic risk-adjusted return metric from modern portfolio theory.
It helps identify which assets have outperformed their benchmark on a risk-adjusted basis and ranks them in real time, with optional gating and visual tools. ๐
โจ Key Features
โข ๐งฉ Multi-Asset Comparison: Evaluate up to four assets simultaneously.
โข ๐ Adaptive Benchmarking: TOTALES mode uses CRYPTOCAP:TOTALES (total crypto market cap ex-stablecoins). Dynamic mode automatically selects the strongest benchmark among BTC, ETH, and TOTALES based on rolling momentum.
โข ๐ Jensenโs Alpha Calculation: Uses rolling covariance, variance, and beta to estimate ฮฑ, showing how much each asset outperformed its benchmark.
โข ๐ Z-Score & Consistency Metrics: Z-Score highlights statistical deviations in alpha; Consistency % shows how often ฮฑ has been positive over a chosen window.
โข ๐ฆ Trend & Zero Gates: Optional filters that require assets to be above EMA (trend) and/or have ฮฑ > 0 for confirmation.
โข ๐ Leaders Board Table: Displays ฮฑ, Z, Rank, Consistency %, and Gate โ/โ for all assets in a clear visual layout.
โข ๐ Dynamic Alerts: Get notified whenever the top alpha leader changes on confirmed (non-repainting) data.
โข ๐จ Visual Enhancements: Smooth ฮฑ with an SMA or color bars by the current top-performing asset.
๐งญ Typical Use Cases
โข ๐ Portfolio Rotation & Relative Strength: Identify which assets consistently outperform their benchmark to optimize capital allocation.
โข ๐งฎ Alpha Persistence Analysis: Gauge whether a trendโs performance advantage is statistically sustainable.
โข ๐ Market Regime Insight: Observe how asset leadership rotates as benchmarks shift across market cycles.
โ๏ธ Inputs Overview
โข ๐ Assets (1โ4): Select up to four tickers for evaluation.
โข ๐งญ Benchmark Mode: Choose between static TOTALES or Dynamic auto-selection.
โข ๐ Alpha Settings: Adjustable lookback, smoothing, and consistency windows.
โข ๐ฆ Gates: Optional trend and alpha filters to refine results.
โข ๐ฅ๏ธ Display: Enable/disable table and customize colors.
โข ๐ Alerts: Toggle notifications on leadership changes.
๐ Formula Basis
Jensenโs Alpha (ฮฑ) is estimated as:
ฮฑ = E โ ฮฒ ร E
where ฮฒ = Cov(Ra, Rb) / Var(Rb), and Ra/Rb represent asset and benchmark returns, respectively.
A positive ฮฑ indicates outperformance relative to the risk-adjusted benchmark expectation. โ
โ ๏ธ Disclaimer
This script is for educational and analytical purposes only.
It is NOT a signal. ๐ซ๐
It does not constitute financial advice, trading signals, or investment recommendations. ๐ฌ
The author is not responsible for any financial losses or trading decisions made based on this indicator. ๐
Always perform your own analysis and use proper risk management. ๐ก๏ธ






















